

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>故障排除 &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/css/custom.css" type="text/css" />

  
  
    <link rel="shortcut icon" href="../../_static/favicon.ico"/>
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
        <script src="../../_static/jquery.js"></script>
        <script src="../../_static/underscore.js"></script>
        <script src="../../_static/doctools.js"></script>
    
    <script type="text/javascript" src="../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../genindex/" />
    <link rel="search" title="Search" href="../../search/" />
    <link rel="next" title="radosgw – rados REST 风格的网关" href="../../man/8/radosgw/" />
    <link rel="prev" title="OpenID Connect Provider in RGW" href="../oidc/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    

















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../" class="icon icon-home"></a> &raquo;</li>
        
          <li><a href="../">Ceph 对象网关</a> &raquo;</li>
        
      <li>故障排除</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="../../_sources/radosgw/troubleshooting.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../">
          

          
            
            <img src="../../_static/logo.png" class="logo" alt="Logo"/>
          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../start/intro/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../cephadm/">Cephadm</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../">Ceph 对象网关</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../frontends/">HTTP 前端</a></li>
<li class="toctree-l2"><a class="reference internal" href="../placement/">存储池归置与存储类</a></li>
<li class="toctree-l2"><a class="reference internal" href="../multisite/">多站配置</a></li>
<li class="toctree-l2"><a class="reference internal" href="../multisite-sync-policy/">多站同步策略配置</a></li>
<li class="toctree-l2"><a class="reference internal" href="../pools/">存储池的配置</a></li>
<li class="toctree-l2"><a class="reference internal" href="../config-ref/">配置参考</a></li>
<li class="toctree-l2"><a class="reference internal" href="../admin/">管理指南</a></li>
<li class="toctree-l2"><a class="reference internal" href="../s3/">S3 API</a></li>
<li class="toctree-l2"><a class="reference internal" href="../rgw-cache/">Data caching and CDN</a></li>
<li class="toctree-l2"><a class="reference internal" href="../swift/">Swift API</a></li>
<li class="toctree-l2"><a class="reference internal" href="../adminops/">管理操作 API</a></li>
<li class="toctree-l2"><a class="reference internal" href="../api/">Python 接口</a></li>
<li class="toctree-l2"><a class="reference internal" href="../nfs/">通过 NFS 导出</a></li>
<li class="toctree-l2"><a class="reference internal" href="../keystone/">与 OpenStack Keystone 对接</a></li>
<li class="toctree-l2"><a class="reference internal" href="../barbican/">与 OpenStack Barbican 对接</a></li>
<li class="toctree-l2"><a class="reference internal" href="../vault/">与 HashiCorp Vault 对接</a></li>
<li class="toctree-l2"><a class="reference internal" href="../kmip/">KMIP Integration</a></li>
<li class="toctree-l2"><a class="reference internal" href="../opa/">与 Open Policy Agent 对接</a></li>
<li class="toctree-l2"><a class="reference internal" href="../multitenancy/">多租户</a></li>
<li class="toctree-l2"><a class="reference internal" href="../compression/">压缩</a></li>
<li class="toctree-l2"><a class="reference internal" href="../ldap-auth/">LDAP 认证</a></li>
<li class="toctree-l2"><a class="reference internal" href="../encryption/">服务器端加密</a></li>
<li class="toctree-l2"><a class="reference internal" href="../bucketpolicy/">桶策略</a></li>
<li class="toctree-l2"><a class="reference internal" href="../dynamicresharding/">动态的桶索引重分片</a></li>
<li class="toctree-l2"><a class="reference internal" href="../mfa/">多因子认证</a></li>
<li class="toctree-l2"><a class="reference internal" href="../sync-modules/">同步模块</a></li>
<li class="toctree-l2"><a class="reference internal" href="../notifications/">Bucket Notifications</a></li>
<li class="toctree-l2"><a class="reference internal" href="../layout/">RADOS 中的数据布局</a></li>
<li class="toctree-l2"><a class="reference internal" href="../STS/">STS</a></li>
<li class="toctree-l2"><a class="reference internal" href="../STSLite/">STS Lite</a></li>
<li class="toctree-l2"><a class="reference internal" href="../keycloak/">Keycloak</a></li>
<li class="toctree-l2"><a class="reference internal" href="../role/">Role</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session-tags/">Session Tags</a></li>
<li class="toctree-l2"><a class="reference internal" href="../orphans/">Orphan List and Associated Tooliing</a></li>
<li class="toctree-l2"><a class="reference internal" href="../oidc/">OpenID Connect Provider</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">故障排除</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#id2">网关启不起来</a></li>
<li class="toctree-l3"><a class="reference internal" href="#http">HTTP 请求错误</a></li>
<li class="toctree-l3"><a class="reference internal" href="#radosgw"><code class="docutils literal notranslate"><span class="pre">radosgw</span></code> 进程崩溃</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id3">阻塞的 <code class="docutils literal notranslate"><span class="pre">radosgw</span></code> 请求</a></li>
<li class="toctree-l3"><a class="reference internal" href="#java-s3-api">Java S3 API 故障排除</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#id4">互联点没认证</a></li>
<li class="toctree-l4"><a class="reference internal" href="#methodnotallowed">405 MethodNotAllowed</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#default-rgw-meta">default.rgw.meta 存储池里的几个对象</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#metadata-heap">禁用 Metadata Heap 字段</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id5">清理 Metadata Heap 存储池</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../man/8/radosgw/">radosgw 手册页</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../man/8/radosgw-admin/">radosgw-admin 手册页</a></li>
<li class="toctree-l2"><a class="reference internal" href="../qat-accel/">使用 QAT 为加密和压缩提速</a></li>
<li class="toctree-l2"><a class="reference internal" href="../s3select/">S3-select</a></li>
<li class="toctree-l2"><a class="reference internal" href="../lua-scripting/">Lua Scripting</a></li>
<li class="toctree-l2"><a class="reference internal" href="../d3n_datacache/">D3N Data Cache</a></li>
<li class="toctree-l2"><a class="reference internal" href="../cloud-transition/">Cloud Transition</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <div class="section" id="id1">
<h1>故障排除<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h1>
<div class="section" id="id2">
<h2>网关启不起来<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h2>
<p>如果你启动不了网关（就是没有 <code class="docutils literal notranslate"><span class="pre">pid</span></code> ），检查下有没有 <code class="docutils literal notranslate"><span class="pre">.asok</span></code> 文件、
它是不是属于另外一个用户。如果有 <code class="docutils literal notranslate"><span class="pre">.asok</span></code> 文件、但属于另外一个用户，
而且没有在运行的 <code class="docutils literal notranslate"><span class="pre">pid</span></code> ，删掉 <code class="docutils literal notranslate"><span class="pre">.asok</span></code> 文件并重启一下这个进程。
这种情况发生在你以 <code class="docutils literal notranslate"><span class="pre">root</span></code> 用户启动了进程、
而启动脚本尝试以 <code class="docutils literal notranslate"><span class="pre">www-data</span></code> 或 <code class="docutils literal notranslate"><span class="pre">apache</span></code> 用户启动、
而且已经存在的 <code class="docutils literal notranslate"><span class="pre">.asok</span></code> 妨碍了脚本启动这个进程。</p>
<p>radosgw 初始化脚本（ /etc/init.d/radosgw ）也有一个详情参数，
可以让你深入了解问题所在：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">init</span><span class="o">.</span><span class="n">d</span><span class="o">/</span><span class="n">radosgw</span> <span class="n">start</span> <span class="o">-</span><span class="n">v</span>
</pre></div>
</div>
<p>或者：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">/</span><span class="n">etc</span><span class="o">/</span><span class="n">init</span><span class="o">.</span><span class="n">d</span> <span class="n">radosgw</span> <span class="n">start</span> <span class="o">--</span><span class="n">verbose</span>
</pre></div>
</div>
</div>
<div class="section" id="http">
<h2>HTTP 请求错误<a class="headerlink" href="#http" title="Permalink to this headline">¶</a></h2>
<p>检查 web 服务器自身的访问日志和错误日志可能是找出问题的第一步。
如果有 500 错误，通常说明和 <code class="docutils literal notranslate"><span class="pre">radosgw</span></code> 守护进程的通讯有问题。
确保这个守护进程在运行，它的套接字路径配置了，
而且 web 服务器去正确的位置找它了。</p>
</div>
<div class="section" id="radosgw">
<h2><code class="docutils literal notranslate"><span class="pre">radosgw</span></code> 进程崩溃<a class="headerlink" href="#radosgw" title="Permalink to this headline">¶</a></h2>
<p>如果 <code class="docutils literal notranslate"><span class="pre">radosgw</span></code> 进程挂了，一般会看到网页服务器（ apache 、 nginx 等）返回 500 错误，这种情况下，只要重启 radosgw 就能恢复服务。</p>
<p>要调查崩溃原因，请检查 <code class="docutils literal notranslate"><span class="pre">/var/log/ceph</span></code> 里的日志、以及核心转储文件（如果生成了）。</p>
</div>
<div class="section" id="id3">
<h2>阻塞的 <code class="docutils literal notranslate"><span class="pre">radosgw</span></code> 请求<a class="headerlink" href="#id3" title="Permalink to this headline">¶</a></h2>
<p>如果某些（或者所有） radosgw 请求被阻塞了，你可以通过管理套接字深入了解 <code class="docutils literal notranslate"><span class="pre">radosgw</span></code> 守护进程的内部状态。默认情况下，套接字文件位于 <code class="docutils literal notranslate"><span class="pre">/var/run/ceph</span></code> ，可以这样查询：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">daemon</span> <span class="o">/</span><span class="n">var</span><span class="o">/</span><span class="n">run</span><span class="o">/</span><span class="n">ceph</span><span class="o">/</span><span class="n">client</span><span class="o">.</span><span class="n">rgw</span> <span class="n">help</span>

<span class="n">help</span>                <span class="nb">list</span> <span class="n">available</span> <span class="n">commands</span>
<span class="n">objecter_requests</span>   <span class="n">show</span> <span class="ow">in</span><span class="o">-</span><span class="n">progress</span> <span class="n">osd</span> <span class="n">requests</span>
<span class="n">perfcounters_dump</span>   <span class="n">dump</span> <span class="n">perfcounters</span> <span class="n">value</span>
<span class="n">perfcounters_schema</span> <span class="n">dump</span> <span class="n">perfcounters</span> <span class="n">schema</span>
<span class="n">version</span>             <span class="n">get</span> <span class="n">protocol</span> <span class="n">version</span>
</pre></div>
</div>
<p>某个特定请求：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">daemon</span> <span class="o">/</span><span class="n">var</span><span class="o">/</span><span class="n">run</span><span class="o">/</span><span class="n">ceph</span><span class="o">/</span><span class="n">client</span><span class="o">.</span><span class="n">rgw</span> <span class="n">objecter_requests</span>
<span class="o">...</span>
</pre></div>
</div>
<p>它会显示当前正在进行的、发往 RADOS 集群的请求。用这个功能你就能确定是否有请求因 OSD 不响应而被阻塞，比如，你也许能看到：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">{</span> <span class="s2">&quot;ops&quot;</span><span class="p">:</span> <span class="p">[</span>
      <span class="p">{</span> <span class="s2">&quot;tid&quot;</span><span class="p">:</span> <span class="mi">1858</span><span class="p">,</span>
        <span class="s2">&quot;pg&quot;</span><span class="p">:</span> <span class="s2">&quot;2.d2041a48&quot;</span><span class="p">,</span>
        <span class="s2">&quot;osd&quot;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
        <span class="s2">&quot;last_sent&quot;</span><span class="p">:</span> <span class="s2">&quot;2012-03-08 14:56:37.949872&quot;</span><span class="p">,</span>
        <span class="s2">&quot;attempts&quot;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
        <span class="s2">&quot;object_id&quot;</span><span class="p">:</span> <span class="s2">&quot;fatty_25647_object1857&quot;</span><span class="p">,</span>
        <span class="s2">&quot;object_locator&quot;</span><span class="p">:</span> <span class="s2">&quot;@2&quot;</span><span class="p">,</span>
        <span class="s2">&quot;snapid&quot;</span><span class="p">:</span> <span class="s2">&quot;head&quot;</span><span class="p">,</span>
        <span class="s2">&quot;snap_context&quot;</span><span class="p">:</span> <span class="s2">&quot;0=[]&quot;</span><span class="p">,</span>
        <span class="s2">&quot;mtime&quot;</span><span class="p">:</span> <span class="s2">&quot;2012-03-08 14:56:37.949813&quot;</span><span class="p">,</span>
        <span class="s2">&quot;osd_ops&quot;</span><span class="p">:</span> <span class="p">[</span>
              <span class="s2">&quot;write 0~4096&quot;</span><span class="p">]},</span>
      <span class="p">{</span> <span class="s2">&quot;tid&quot;</span><span class="p">:</span> <span class="mi">1873</span><span class="p">,</span>
        <span class="s2">&quot;pg&quot;</span><span class="p">:</span> <span class="s2">&quot;2.695e9f8e&quot;</span><span class="p">,</span>
        <span class="s2">&quot;osd&quot;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
        <span class="s2">&quot;last_sent&quot;</span><span class="p">:</span> <span class="s2">&quot;2012-03-08 14:56:37.970615&quot;</span><span class="p">,</span>
        <span class="s2">&quot;attempts&quot;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
        <span class="s2">&quot;object_id&quot;</span><span class="p">:</span> <span class="s2">&quot;fatty_25647_object1872&quot;</span><span class="p">,</span>
        <span class="s2">&quot;object_locator&quot;</span><span class="p">:</span> <span class="s2">&quot;@2&quot;</span><span class="p">,</span>
        <span class="s2">&quot;snapid&quot;</span><span class="p">:</span> <span class="s2">&quot;head&quot;</span><span class="p">,</span>
        <span class="s2">&quot;snap_context&quot;</span><span class="p">:</span> <span class="s2">&quot;0=[]&quot;</span><span class="p">,</span>
        <span class="s2">&quot;mtime&quot;</span><span class="p">:</span> <span class="s2">&quot;2012-03-08 14:56:37.970555&quot;</span><span class="p">,</span>
        <span class="s2">&quot;osd_ops&quot;</span><span class="p">:</span> <span class="p">[</span>
              <span class="s2">&quot;write 0~4096&quot;</span><span class="p">]}],</span>
<span class="s2">&quot;linger_ops&quot;</span><span class="p">:</span> <span class="p">[],</span>
<span class="s2">&quot;pool_ops&quot;</span><span class="p">:</span> <span class="p">[],</span>
<span class="s2">&quot;pool_stat_ops&quot;</span><span class="p">:</span> <span class="p">[],</span>
<span class="s2">&quot;statfs_ops&quot;</span><span class="p">:</span> <span class="p">[]}</span>
</pre></div>
</div>
<p>在上面的显示中，有两个请求正在进行。 <code class="docutils literal notranslate"><span class="pre">last_sent</span></code> 字段是 RADOS 请求发出的时间，如果以及有一段时间了，说明那个 OSD 没响应。例如，对于 1858 这个请求，你可以这样检查 OSD 状态：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">pg</span> <span class="nb">map</span> <span class="mf">2.</span><span class="n">d2041a48</span>

<span class="n">osdmap</span> <span class="n">e9</span> <span class="n">pg</span> <span class="mf">2.</span><span class="n">d2041a48</span> <span class="p">(</span><span class="mf">2.0</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">up</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">]</span> <span class="n">acting</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">]</span>
</pre></div>
</div>
<p>这说明，我们得查看 <code class="docutils literal notranslate"><span class="pre">osd.1</span></code> ，它是这个 PG 的主副本：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">daemon</span> <span class="n">osd</span><span class="mf">.1</span> <span class="n">ops</span>
<span class="p">{</span> <span class="s2">&quot;num_ops&quot;</span><span class="p">:</span> <span class="mi">651</span><span class="p">,</span>
 <span class="s2">&quot;ops&quot;</span><span class="p">:</span> <span class="p">[</span>
       <span class="p">{</span> <span class="s2">&quot;description&quot;</span><span class="p">:</span> <span class="s2">&quot;osd_op(client.4124.0:1858 fatty_25647_object1857 [write 0~4096] 2.d2041a48)&quot;</span><span class="p">,</span>
         <span class="s2">&quot;received_at&quot;</span><span class="p">:</span> <span class="s2">&quot;1331247573.344650&quot;</span><span class="p">,</span>
         <span class="s2">&quot;age&quot;</span><span class="p">:</span> <span class="s2">&quot;25.606449&quot;</span><span class="p">,</span>
         <span class="s2">&quot;flag_point&quot;</span><span class="p">:</span> <span class="s2">&quot;waiting for sub ops&quot;</span><span class="p">,</span>
         <span class="s2">&quot;client_info&quot;</span><span class="p">:</span> <span class="p">{</span> <span class="s2">&quot;client&quot;</span><span class="p">:</span> <span class="s2">&quot;client.4124&quot;</span><span class="p">,</span>
             <span class="s2">&quot;tid&quot;</span><span class="p">:</span> <span class="mi">1858</span><span class="p">}},</span>
<span class="o">...</span>
</pre></div>
</div>
<p><code class="docutils literal notranslate"><span class="pre">flag_point</span></code> 字段表明这个 OSD 正在等待副本（本例中是 <code class="docutils literal notranslate"><span class="pre">osd.0</span></code> ）的响应。</p>
</div>
<div class="section" id="java-s3-api">
<h2>Java S3 API 故障排除<a class="headerlink" href="#java-s3-api" title="Permalink to this headline">¶</a></h2>
<div class="section" id="id4">
<h3>互联点没认证<a class="headerlink" href="#id4" title="Permalink to this headline">¶</a></h3>
<p>你可能会遇到类似这样的错误：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">java</span><span class="p">]</span> <span class="n">INFO</span><span class="p">:</span> <span class="n">Unable</span> <span class="n">to</span> <span class="n">execute</span> <span class="n">HTTP</span> <span class="n">request</span><span class="p">:</span> <span class="n">peer</span> <span class="ow">not</span> <span class="n">authenticated</span>
</pre></div>
</div>
<p>S3 的 Java SDK 需要一个认可的证书机构颁发的合法证书，因为它默认使用 HTTPS 。
如果你只是想测试一下 Ceph 对象存储服务，可以用这几种方法解决这个问题：</p>
<ol class="arabic">
<li><p>在 IP 地址或主机名前加 <code class="docutils literal notranslate"><span class="pre">http://</span></code> 。例如，改这行：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">conn</span><span class="o">.</span><span class="n">setEndpoint</span><span class="p">(</span><span class="s2">&quot;myserver&quot;</span><span class="p">);</span>
</pre></div>
</div>
<p>改成:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">conn</span><span class="o">.</span><span class="n">setEndpoint</span><span class="p">(</span><span class="s2">&quot;http://myserver&quot;</span><span class="p">)</span>
</pre></div>
</div>
</li>
<li><p>配置好凭证后，加上客户端配置、并把协议设置成
<code class="docutils literal notranslate"><span class="pre">Protocol.HTTP</span></code> 。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">AWSCredentials</span> <span class="n">credentials</span> <span class="o">=</span> <span class="n">new</span> <span class="n">BasicAWSCredentials</span><span class="p">(</span><span class="n">accessKey</span><span class="p">,</span> <span class="n">secretKey</span><span class="p">);</span>

<span class="n">ClientConfiguration</span> <span class="n">clientConfig</span> <span class="o">=</span> <span class="n">new</span> <span class="n">ClientConfiguration</span><span class="p">();</span>
<span class="n">clientConfig</span><span class="o">.</span><span class="n">setProtocol</span><span class="p">(</span><span class="n">Protocol</span><span class="o">.</span><span class="n">HTTP</span><span class="p">);</span>

<span class="n">AmazonS3</span> <span class="n">conn</span> <span class="o">=</span> <span class="n">new</span> <span class="n">AmazonS3Client</span><span class="p">(</span><span class="n">credentials</span><span class="p">,</span> <span class="n">clientConfig</span><span class="p">);</span>
</pre></div>
</div>
</li>
</ol>
</div>
<div class="section" id="methodnotallowed">
<h3>405 MethodNotAllowed<a class="headerlink" href="#methodnotallowed" title="Permalink to this headline">¶</a></h3>
<p>如果你遇到了 405 错误，检查一下你是否配置好了 S3 子域。
你得在子域的 DNS 记录里配置通配符，这样它才能正常工作。</p>
<p>还有，要确保禁用了默认站点。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">java</span><span class="p">]</span> <span class="ne">Exception</span> <span class="ow">in</span> <span class="n">thread</span> <span class="s2">&quot;main&quot;</span> <span class="n">Status</span> <span class="n">Code</span><span class="p">:</span> <span class="mi">405</span><span class="p">,</span> <span class="n">AWS</span> <span class="n">Service</span><span class="p">:</span> <span class="n">Amazon</span> <span class="n">S3</span><span class="p">,</span> <span class="n">AWS</span> <span class="n">Request</span> <span class="n">ID</span><span class="p">:</span> <span class="n">null</span><span class="p">,</span> <span class="n">AWS</span> <span class="n">Error</span> <span class="n">Code</span><span class="p">:</span> <span class="n">MethodNotAllowed</span><span class="p">,</span> <span class="n">AWS</span> <span class="n">Error</span> <span class="n">Message</span><span class="p">:</span> <span class="n">null</span><span class="p">,</span> <span class="n">S3</span> <span class="n">Extended</span> <span class="n">Request</span> <span class="n">ID</span><span class="p">:</span> <span class="n">null</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="default-rgw-meta">
<h2>default.rgw.meta 存储池里的几个对象<a class="headerlink" href="#default-rgw-meta" title="Permalink to this headline">¶</a></h2>
<p>在 <em>jewel</em> 之前创建的集群上有一个元数据存档功能是默认启用的，
用的是 <code class="docutils literal notranslate"><span class="pre">default.rgw.meta</span></code> 存储池。这个存档保留着用户和桶元数据的所有老版本，
导致 <code class="docutils literal notranslate"><span class="pre">default.rgw.meta</span></code> 存储池里产生了大量的对象。</p>
<div class="section" id="metadata-heap">
<h3>禁用 Metadata Heap 字段<a class="headerlink" href="#metadata-heap" title="Permalink to this headline">¶</a></h3>
<p>想要禁用此功能的用户可以把 <code class="docutils literal notranslate"><span class="pre">metadata_heap</span></code> 字段设置为空字符串 <code class="docutils literal notranslate"><span class="pre">&quot;&quot;</span></code>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ radosgw-admin zone get --rgw-zone=default &gt; zone.json
[edit zone.json, setting &quot;metadata_heap&quot;: &quot;&quot;]
$ radosgw-admin zone set --rgw-zone=default --infile=zone.json
$ radosgw-admin period update --commit
</pre></div>
</div>
<p>这样新的元数据就不会再写入 <code class="docutils literal notranslate"><span class="pre">default.rgw.meta</span></code> 存储池了，
但是所有现有的对象或存储池都不会删除。</p>
</div>
<div class="section" id="id5">
<h3>清理 Metadata Heap 存储池<a class="headerlink" href="#id5" title="Permalink to this headline">¶</a></h3>
<p>在 <em>jewel</em> 之前创建的集群的 <code class="docutils literal notranslate"><span class="pre">default.rgw.meta</span></code> 存储池通常只用作元数据归档。</p>
<p>而从 <em>luminous</em> 起， radosgw 利用 <code class="docutils literal notranslate"><span class="pre">default.rgw.meta</span></code> 存储池的 <a class="reference internal" href="../pools/#radosgw-pool-namespaces"><span class="std std-ref">存储池命名空间</span></a> 的目的完全变了，就是说，用来存储 <code class="docutils literal notranslate"><span class="pre">user_keys</span></code> 和其它关键元数据了。</p>
<p>用户们在清理之前应该核对一下域配置信息：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ radosgw-admin zone get --rgw-zone=default | grep default.rgw.meta
[should not match any strings]
</pre></div>
</div>
<p>确认过这个存储池确实没在用，用户就可以安全删除
<code class="docutils literal notranslate"><span class="pre">default.rgw.meta</span></code> 存储池里的所有对象了，或者干脆删除整个存储池。</p>
</div>
</div>
</div>



           </div>
           
          </div>
          <footer>
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
        <a href="../../man/8/radosgw/" class="btn btn-neutral float-right" title="radosgw – rados REST 风格的网关" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
        <a href="../oidc/" class="btn btn-neutral float-left" title="OpenID Connect Provider in RGW" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>
        &#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).

    </p>
  </div> 

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>